/**
    入驻小区
**/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            adminShopInfo: {
                shops: [
                    {
                        shopId:'',
                        shopName:'全部'
                    }
                ],
                shopId:'',
                callBack:{}
            }
        },
        _initMethod: function () {
        },
        _initEvent: function () {
            vc.on('adminShop', 'initShop', function (_param) {
                $that.adminShopInfo.callBack = _param;
                $that._listAdminShops(DEFAULT_PAGE, DEFAULT_ROWS);
            });
        },
        methods: {
           
            _listAdminShops: function(_page, _rows) {
                let param = {
                    params: {
                        page: 1,
                        row: 100,
                    }
                };
                let _shops = [
                    {
                        shopId:'',
                        shopName:'全部'
                    }
                ];

                //发送get请求
                vc.http.apiGet('/shop.queryShopsByAdmin',
                    param,
                    function(json, res) {
                        let _json = JSON.parse(json);
                        _json.data.forEach(s => {
                            _shops.push(s);
                        });
                        $that.adminShopInfo.shops = _shops;
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            swatchAdminShopId:function(_shop){
                $that.adminShopInfo.shopId = _shop.shopId;
                $that.adminShopInfo.callBack(_shop);
            },
          
            
        }
    });
})(window.vc);
